/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package DNK.newpackage.newpackage;
import java.util.Random;
import java.io.*;
/**
 *
 * @author m10frr
 */
public class DNK {
    private static int M=5;
    private static int N=10;
char[] c={'A','B','C','D','E'};
String str;
Random r = new Random();
public DNK() throws IOException{
    str="";
    for(long i=1;i<N;i++)
    {
        str+=c[r.nextInt(M)];
    }
}
private long dnk1()
{
    long start=System.currentTimeMillis();
    boolean found=true;
    System.out.println(str);
    lab1: for(int i=0;i<N-M-1;i++)
    {
        found=true;
        for(int j=i+1;j<N-M;j++)
        {
            for(int k=0;k<M;k++)
                if((str.charAt(k+i))!=(str.charAt(k+j))) found=false;
            if(found) {for(int k=0;k<M;k++) System.out.print(str.charAt(k+j));found=true;break lab1;}
        }
        }
    if(found!=true) System.out.println("Not Found");
    System.out.println("");
    return (System.currentTimeMillis()-start);
}
/*private long dnk2()
{
    long start=System.currentTimeMillis();
    Arrays.
    String.
    return (System.currentTimeMillis()-start);
}*/
public static void main(String[] args) throws IOException {
    DNK test=new DNK();
    System.out.println(test.dnk1());
    //System.out.println(test.dnk2());
}
}
